package com.eaoa.uc.busorder.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.query.bus.BusOrderQuery;
import com.stony.core.struts.action.BaseAction;

public class BusOrderSearchOnlineAction extends BaseAction{
	
	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		String ordernos = request.getParameter("ordernos");
		
		if(ordernos!=null && StringUtils.isNotBlank(ordernos)){
			String[] billcodes = ordernos.split(",");

			BusOrderQuery query = new BusOrderQuery();
			query.setBillcode(billcodes);
			query.execute();
			request.setAttribute("results", query.getResults());
		}
		
		return mapping.findForward("success");
	}
}
